<?php

class Template {

    protected $variables = array();
    protected $_controller;
    protected $_action;

    function __construct($controller, $action) {
        $this->_controller = $controller;
        $this->_action = $action;
    }

    /** Set Variables * */
    function set($name, $value) {
        $this->variables[$name] = $value;
    }

    /** Display Template * */
    function render($doNotRenderHeader = 0) {
        $html = new HTML;
        extract($this->variables);
		//echo "<br>".ROOT . DS . 'application' . DS . 'view' . DS . str_replace("Controller","",$this->_controller) . DS . $this->_action . '.php';
        if (file_exists(ROOT . DS . 'application' . DS . 'view' . DS . str_replace("Controller","",$this->_controller) . DS . $this->_action . '.php')) {
            include (ROOT . DS . 'application' . DS . 'view' . DS . str_replace("Controller","",$this->_controller) . DS . $this->_action . '.php');
        }
    }

}
